/**
 * \file EnemyManager.h
 * \author Niels van Galen Last & Erik Kok
 * \date 01-15-08
 */
#ifndef ENEMY_MANAGER_H
#define ENEMY_MANAGER_H

#include "ExampleApplication.h"
#include "Enemy.h"

/**
 * EnemyManager is the class with tracks all the enemies. It determines whether
 * they are alive and updates them according the position of the player.
 */
class EnemyManager
{
public:
	/// Default constructor
	EnemyManager() {}
	
	/// Overloaded constructor
	EnemyManager(OgreOde::World* world);
		
	/// Default destructor
	~EnemyManager() {}

	/**
	 * Send the position of the player to each of the enemies who are alive
	 * \param Vector3 The position of the player
	 */
	void update(Vector3 player_pos);
	
		
	/**
	 * Bring a new enemy in the play to destroy the player.
	 * \param Vector3 the position of the player.
	 */
	void create_enemy(Vector3 position, Vector3 ogre_pos);
		
	/**
	 * An enemy collide with a player or was shot so we remove it from the stack
	 * \param Geometry the geometry of the enemy to delete
	 */
	void delete_enemy(OgreOde::Geometry *del);
	
	/**
	 * Get the amount of enemies in play
	 * \return int Size of the enemie stack
	 */
	int get_enemy_size() const { return enemies.size(); }
	
	/**
	 * Get the total amount of enemies who are shot
	 * \return int Amount of dead enemies
	 */	
	int get_enemy_kills() const { return (int) kill_counter; }
    Ogre::SceneManager      *mSceneMgr;
private:
	OgreOde::World* world;
	
	unsigned int counter;
	unsigned int kill_counter;
	Ogre::String			mName;	
	OgreOde::Body           *mBody;
    OgreOde::Geometry       *mGeom;
    OgreOde::World          *mWorld;
    OgreOde::BoxMass        *mMass;
    OgreOde::Space          *mSpace;

    Ogre::SceneNode         *enemy_node;
    Ogre::Entity            *enemy_entity;

	typedef std::pair<BoidAirCraftPtr, Behavior*> CraftBehaviorPair;
	typedef std::vector<CraftBehaviorPair> CraftList;
	CraftList mAirCraftBoids;

	std::vector<Enemy*> enemies;

	std::vector<Enemy*>::iterator iter;
};



#endif
